<?php

namespace app\office\model;

use think\Model;

class Navbar extends Model
{
    // 获取无限分类结构数组navbar_tree,此处的树状结构与organization的不一样
    public static function getTree($parent_id=0,$level=0){
      $tree=array();
      foreach(self::select() as $key=>$row){
        if($row['parent_id']==$parent_id){
          $row['level']=$level;
          $row['son']=self::getTree($row['id'],$level+1);
          $tree[]=$row;
        }
      }
      return $tree;
    }
}
